<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

class client extends CI_Controller {

	function __construct() {
		parent::__construct();
		$this -> load -> helper('url');
		$this -> load -> library('xmlrpc');

		$server_url = site_url('server');
		$this -> xmlrpc -> server($server_url, 80);
	}

    function index() {
        $this->xmlrpc->method('login');
        $request = array('admin', 'admin');
        $this->xmlrpc->request($request);
        //$this->xmlrpc->set_debug(TRUE);
        if (!$this->xmlrpc->send_request()) {
            $this->xmlrpc->display_error();
        } else {
            echo '<pre>';
            print_r($this->xmlrpc->display_response());
            echo '</pre>';
        }
        exit();
    }

    function data(){
        $this->xmlrpc->method('getdata');
        //$this->xmlrpc->set_debug(TRUE);
        if (!$this->xmlrpc->send_request()) {
            $this->xmlrpc->display_error();
        } else {
            echo '<pre>';
            print_r($this->xmlrpc->display_response());
            echo '</pre>';
        }
        exit();
    }

    function getbyid()
    {
        $this->xmlrpc->method('getbyid');
        //$this->xmlrpc->set_debug(TRUE);
        $request = array('2010 111');
        $this->xmlrpc->request($request);
        if (!$this->xmlrpc->send_request($request)) {
            $this->xmlrpc->display_error();
        } else {
            echo '<pre>';
            print_r($this->xmlrpc->display_response());
            echo '</pre>';
        }
        exit();
    }

    function cek() {
        $this->xmlrpc->method('cekstatus');
        $request = array('Baskoro', 'Juragan', '2010 111', '61970');
        $this->xmlrpc->request($request);
        //$this->xmlrpc->set_debug(TRUE);
        if (!$this->xmlrpc->send_request()) {
            $this->xmlrpc->display_error();
        } else {
            echo '<pre>';
            print_r($this->xmlrpc->display_response());
            echo '</pre>';
        }
        exit();
    }


    function ceklengkap() {
        $this->xmlrpc->method('cekstatuslengkap');
        $request = array('Baskoro', 'Juragan', '2010 111', '61970');
        $this->xmlrpc->request($request);
        $this->xmlrpc->set_debug(TRUE);
        if (!$this->xmlrpc->send_request()) {
            $this->xmlrpc->display_error();
        } else {
            echo '<pre>';
            print_r($this->xmlrpc->display_response());
            echo '</pre>';
        }
        exit();
    }


    function ubah() {
        $this->xmlrpc->method('ubahketerangan');
        $request = array('2010 111', '1');
        $this->xmlrpc->request($request);
        //$this->xmlrpc->set_debug(TRUE);
        if (!$this->xmlrpc->send_request()) {
            $this->xmlrpc->display_error();
        } else {
            echo '<pre>';
            print_r($this->xmlrpc->display_response());
            echo '</pre>';
        }
        exit();
    }
}
?>